{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting apyori\n",
      "  Downloading https://files.pythonhosted.org/packages/5e/62/5ffde5c473ea4b033490617ec5caa80d59804875ad3c3c57c0976533a21a/apyori-1.1.2.tar.gz\n",
      "Building wheels for collected packages: apyori\n",
      "  Building wheel for apyori (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for apyori: filename=apyori-1.1.2-cp37-none-any.whl size=5975 sha256=b032dd7e384851ed51e7a2ffbf81dfc4c1e3fdc2c2b142953007c9434f809714\n",
      "  Stored in directory: /Users/vverdhan/Library/Caches/pip/wheels/5d/92/bb/474bbadbc8c0062b9eb168f69982a0443263f8ab1711a8cad0\n",
      "Successfully built apyori\n",
      "Installing collected packages: apyori\n",
      "Successfully installed apyori-1.1.2\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "!{sys.executable} -m pip install apyori"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import matplotlib.pyplot as plt\n",
    "import pandas as pd\n",
    "from apyori import apriori"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "store_dataset = pd.read_csv('store_data.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "RangeIndex: 7500 entries, 0 to 7499\n",
      "Data columns (total 20 columns):\n",
      "shrimp               7500 non-null object\n",
      "almonds              5746 non-null object\n",
      "avocado              4388 non-null object\n",
      "vegetables mix       3344 non-null object\n",
      "green grapes         2528 non-null object\n",
      "whole weat flour     1863 non-null object\n",
      "yams                 1368 non-null object\n",
      "cottage cheese       980 non-null object\n",
      "energy drink         653 non-null object\n",
      "tomato juice         394 non-null object\n",
      "low fat yogurt       255 non-null object\n",
      "green tea            153 non-null object\n",
      "honey                86 non-null object\n",
      "salad                46 non-null object\n",
      "mineral water        24 non-null object\n",
      "salmon               7 non-null object\n",
      "antioxydant juice    3 non-null object\n",
      "frozen smoothie      3 non-null object\n",
      "spinach              2 non-null object\n",
      "olive oil            0 non-null float64\n",
      "dtypes: float64(1), object(19)\n",
      "memory usage: 1.1+ MB\n"
     ]
    }
   ],
   "source": [
    "store_dataset.info()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>shrimp</th>\n",
       "      <th>almonds</th>\n",
       "      <th>avocado</th>\n",
       "      <th>vegetables mix</th>\n",
       "      <th>green grapes</th>\n",
       "      <th>whole weat flour</th>\n",
       "      <th>yams</th>\n",
       "      <th>cottage cheese</th>\n",
       "      <th>energy drink</th>\n",
       "      <th>tomato juice</th>\n",
       "      <th>low fat yogurt</th>\n",
       "      <th>green tea</th>\n",
       "      <th>honey</th>\n",
       "      <th>salad</th>\n",
       "      <th>mineral water</th>\n",
       "      <th>salmon</th>\n",
       "      <th>antioxydant juice</th>\n",
       "      <th>frozen smoothie</th>\n",
       "      <th>spinach</th>\n",
       "      <th>olive oil</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>burgers</td>\n",
       "      <td>meatballs</td>\n",
       "      <td>eggs</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>chutney</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>turkey</td>\n",
       "      <td>avocado</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>mineral water</td>\n",
       "      <td>milk</td>\n",
       "      <td>energy bar</td>\n",
       "      <td>whole wheat rice</td>\n",
       "      <td>green tea</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>low fat yogurt</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           shrimp    almonds     avocado    vegetables mix green grapes  \\\n",
       "0         burgers  meatballs        eggs               NaN          NaN   \n",
       "1         chutney        NaN         NaN               NaN          NaN   \n",
       "2          turkey    avocado         NaN               NaN          NaN   \n",
       "3   mineral water       milk  energy bar  whole wheat rice    green tea   \n",
       "4  low fat yogurt        NaN         NaN               NaN          NaN   \n",
       "\n",
       "  whole weat flour yams cottage cheese energy drink tomato juice  \\\n",
       "0              NaN  NaN            NaN          NaN          NaN   \n",
       "1              NaN  NaN            NaN          NaN          NaN   \n",
       "2              NaN  NaN            NaN          NaN          NaN   \n",
       "3              NaN  NaN            NaN          NaN          NaN   \n",
       "4              NaN  NaN            NaN          NaN          NaN   \n",
       "\n",
       "  low fat yogurt green tea honey salad mineral water salmon antioxydant juice  \\\n",
       "0            NaN       NaN   NaN   NaN           NaN    NaN               NaN   \n",
       "1            NaN       NaN   NaN   NaN           NaN    NaN               NaN   \n",
       "2            NaN       NaN   NaN   NaN           NaN    NaN               NaN   \n",
       "3            NaN       NaN   NaN   NaN           NaN    NaN               NaN   \n",
       "4            NaN       NaN   NaN   NaN           NaN    NaN               NaN   \n",
       "\n",
       "  frozen smoothie spinach  olive oil  \n",
       "0             NaN     NaN        NaN  \n",
       "1             NaN     NaN        NaN  \n",
       "2             NaN     NaN        NaN  \n",
       "3             NaN     NaN        NaN  \n",
       "4             NaN     NaN        NaN  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "store_dataset.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "store_dataset = pd.read_csv('store_data.csv', header=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>10</th>\n",
       "      <th>11</th>\n",
       "      <th>12</th>\n",
       "      <th>13</th>\n",
       "      <th>14</th>\n",
       "      <th>15</th>\n",
       "      <th>16</th>\n",
       "      <th>17</th>\n",
       "      <th>18</th>\n",
       "      <th>19</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <td>0</td>\n",
       "      <td>shrimp</td>\n",
       "      <td>almonds</td>\n",
       "      <td>avocado</td>\n",
       "      <td>vegetables mix</td>\n",
       "      <td>green grapes</td>\n",
       "      <td>whole weat flour</td>\n",
       "      <td>yams</td>\n",
       "      <td>cottage cheese</td>\n",
       "      <td>energy drink</td>\n",
       "      <td>tomato juice</td>\n",
       "      <td>low fat yogurt</td>\n",
       "      <td>green tea</td>\n",
       "      <td>honey</td>\n",
       "      <td>salad</td>\n",
       "      <td>mineral water</td>\n",
       "      <td>salmon</td>\n",
       "      <td>antioxydant juice</td>\n",
       "      <td>frozen smoothie</td>\n",
       "      <td>spinach</td>\n",
       "      <td>olive oil</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>1</td>\n",
       "      <td>burgers</td>\n",
       "      <td>meatballs</td>\n",
       "      <td>eggs</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>2</td>\n",
       "      <td>chutney</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>3</td>\n",
       "      <td>turkey</td>\n",
       "      <td>avocado</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <td>4</td>\n",
       "      <td>mineral water</td>\n",
       "      <td>milk</td>\n",
       "      <td>energy bar</td>\n",
       "      <td>whole wheat rice</td>\n",
       "      <td>green tea</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "              0          1           2                 3             4   \\\n",
       "0         shrimp    almonds     avocado    vegetables mix  green grapes   \n",
       "1        burgers  meatballs        eggs               NaN           NaN   \n",
       "2        chutney        NaN         NaN               NaN           NaN   \n",
       "3         turkey    avocado         NaN               NaN           NaN   \n",
       "4  mineral water       milk  energy bar  whole wheat rice     green tea   \n",
       "\n",
       "                 5     6               7             8             9   \\\n",
       "0  whole weat flour  yams  cottage cheese  energy drink  tomato juice   \n",
       "1               NaN   NaN             NaN           NaN           NaN   \n",
       "2               NaN   NaN             NaN           NaN           NaN   \n",
       "3               NaN   NaN             NaN           NaN           NaN   \n",
       "4               NaN   NaN             NaN           NaN           NaN   \n",
       "\n",
       "               10         11     12     13             14      15  \\\n",
       "0  low fat yogurt  green tea  honey  salad  mineral water  salmon   \n",
       "1             NaN        NaN    NaN    NaN            NaN     NaN   \n",
       "2             NaN        NaN    NaN    NaN            NaN     NaN   \n",
       "3             NaN        NaN    NaN    NaN            NaN     NaN   \n",
       "4             NaN        NaN    NaN    NaN            NaN     NaN   \n",
       "\n",
       "                  16               17       18         19  \n",
       "0  antioxydant juice  frozen smoothie  spinach  olive oil  \n",
       "1                NaN              NaN      NaN        NaN  \n",
       "2                NaN              NaN      NaN        NaN  \n",
       "3                NaN              NaN      NaN        NaN  \n",
       "4                NaN              NaN      NaN        NaN  "
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "store_dataset.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "all_records = []\n",
    "for i in range(0, 7501):\n",
    "    all_records.append([str(store_dataset.values[i,j]) for j in range(0, 20)])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "apriori_rules = apriori(all_records, min_support=0.5, min_confidence=0.25, min_lift=4, min_length=2)\n",
    "apriori_rules = list(apriori_rules)\n",
    "print(len(apriori_rules))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "apriori_rules = apriori(all_records, min_support=0.25, min_confidence=0.25, min_lift=4, min_length=2)\n",
    "apriori_rules = list(apriori_rules)\n",
    "print(len(apriori_rules))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n"
     ]
    }
   ],
   "source": [
    "apriori_rules = apriori(all_records, min_support=0.1, min_confidence=0.25, min_lift=4, min_length=2)\n",
    "apriori_rules = list(apriori_rules)\n",
    "print(len(apriori_rules))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "200\n"
     ]
    }
   ],
   "source": [
    "apriori_rules = apriori(all_records, min_support=0.005, min_confidence=0.25, min_lift=2, min_length=2)\n",
    "apriori_rules = list(apriori_rules)\n",
    "print(len(apriori_rules))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RelationRecord(items=frozenset({'almonds', 'burgers'}), support=0.005199306759098787, ordered_statistics=[OrderedStatistic(items_base=frozenset({'almonds'}), items_add=frozenset({'burgers'}), confidence=0.25490196078431376, lift=2.923577382023146)])\n"
     ]
    }
   ],
   "source": [
    "print(apriori_rules[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The apriori rule is: almonds -> burgers\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.25490196078431376\n",
      "The lift for the rule is: 2.923577382023146\n",
      "************************\n",
      "The apriori rule is: cereals -> milk\n",
      "The support for the rule is: 0.007065724570057326\n",
      "The confidence for the rule is: 0.2746113989637306\n",
      "The lift for the rule is: 2.119197637476279\n",
      "************************\n",
      "The apriori rule is: chocolate -> tomato sauce\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.3584905660377358\n",
      "The lift for the rule is: 2.1879883936932925\n",
      "************************\n",
      "The apriori rule is: mushroom cream sauce -> escalope\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.3006993006993007\n",
      "The lift for the rule is: 3.790832696715049\n",
      "************************\n",
      "The apriori rule is: pasta -> escalope\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.3728813559322034\n",
      "The lift for the rule is: 4.700811850163794\n",
      "************************\n",
      "The apriori rule is: mineral water -> extra dark chocolate\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.47777777777777775\n",
      "The lift for the rule is: 2.0043686303753416\n",
      "************************\n",
      "The apriori rule is: frozen vegetables -> parmesan cheese\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.27516778523489926\n",
      "The lift for the rule is: 2.886760219646125\n",
      "************************\n",
      "The apriori rule is: ground beef -> herb & pepper\n",
      "The support for the rule is: 0.015997866951073192\n",
      "The confidence for the rule is: 0.3234501347708895\n",
      "The lift for the rule is: 3.2919938411349285\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.03919477403012932\n",
      "The confidence for the rule is: 0.3989145183175034\n",
      "The lift for the rule is: 2.291162176033379\n",
      "************************\n",
      "The apriori rule is: ground beef -> tomato sauce\n",
      "The support for the rule is: 0.005332622317024397\n",
      "The confidence for the rule is: 0.3773584905660377\n",
      "The lift for the rule is: 3.840659481324083\n",
      "************************\n",
      "The apriori rule is: milk -> meatballs\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.2611464968152866\n",
      "The lift for the rule is: 2.0152879347854578\n",
      "************************\n",
      "The apriori rule is: milk -> soup\n",
      "The support for the rule is: 0.015197973603519531\n",
      "The confidence for the rule is: 0.3007915567282322\n",
      "The lift for the rule is: 2.3212319619531585\n",
      "************************\n",
      "The apriori rule is: milk -> whole wheat pasta\n",
      "The support for the rule is: 0.009865351286495135\n",
      "The confidence for the rule is: 0.33484162895927605\n",
      "The lift for the rule is: 2.5839990317114503\n",
      "************************\n",
      "The apriori rule is: mineral water -> nonfat milk\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.4871794871794871\n",
      "The lift for the rule is: 2.0438105891126024\n",
      "************************\n",
      "The apriori rule is: olive oil -> whole wheat pasta\n",
      "The support for the rule is: 0.007998933475536596\n",
      "The confidence for the rule is: 0.2714932126696833\n",
      "The lift for the rule is: 4.122410097642296\n",
      "************************\n",
      "The apriori rule is: pasta -> shrimp\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.3220338983050847\n",
      "The lift for the rule is: 4.506672147735896\n",
      "************************\n",
      "The apriori rule is: spaghetti -> pepper\n",
      "The support for the rule is: 0.009865351286495135\n",
      "The confidence for the rule is: 0.37185929648241206\n",
      "The lift for the rule is: 2.1357707373005916\n",
      "************************\n",
      "The apriori rule is: spaghetti -> red wine\n",
      "The support for the rule is: 0.010265297960271964\n",
      "The confidence for the rule is: 0.36492890995260663\n",
      "The lift for the rule is: 2.095966120638976\n",
      "************************\n",
      "The apriori rule is: spaghetti -> tomato sauce\n",
      "The support for the rule is: 0.006265831222503666\n",
      "The confidence for the rule is: 0.4433962264150943\n",
      "The lift for the rule is: 2.546642491837383\n",
      "************************\n",
      "The apriori rule is: almonds -> nan\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.25490196078431376\n",
      "The lift for the rule is: 2.923577382023146\n",
      "************************\n",
      "The apriori rule is: chocolate -> milk\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.3203125\n",
      "The lift for the rule is: 2.4718766075102883\n",
      "************************\n",
      "The apriori rule is: spaghetti -> chocolate\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.37500000000000006\n",
      "The lift for the rule is: 2.153809341500766\n",
      "************************\n",
      "The apriori rule is: french fries -> burgers\n",
      "The support for the rule is: 0.009065457938941474\n",
      "The confidence for the rule is: 0.4121212121212121\n",
      "The lift for the rule is: 2.293264994155202\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.45555555555555555\n",
      "The lift for the rule is: 2.616479496341671\n",
      "************************\n",
      "The apriori rule is: mineral water -> milk\n",
      "The support for the rule is: 0.006932409012131715\n",
      "The confidence for the rule is: 0.28415300546448086\n",
      "The lift for the rule is: 2.192830960894106\n",
      "************************\n",
      "The apriori rule is: spaghetti -> milk\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.3582089552238806\n",
      "The lift for the rule is: 2.0573701172544627\n",
      "************************\n",
      "The apriori rule is: cake -> spaghetti\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.3823529411764706\n",
      "The lift for the rule is: 2.1960408972164673\n",
      "************************\n",
      "The apriori rule is: cake -> mineral water\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.48\n",
      "The lift for the rule is: 2.013691275167785\n",
      "************************\n",
      "The apriori rule is: cereals -> milk\n",
      "The support for the rule is: 0.007065724570057326\n",
      "The confidence for the rule is: 0.2746113989637306\n",
      "The lift for the rule is: 2.119197637476279\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.007598986801759766\n",
      "The confidence for the rule is: 0.5181818181818182\n",
      "The lift for the rule is: 2.1738712629652226\n",
      "************************\n",
      "The apriori rule is: mineral water -> milk\n",
      "The support for the rule is: 0.006665777896280496\n",
      "The confidence for the rule is: 0.29239766081871343\n",
      "The lift for the rule is: 2.256455610906553\n",
      "************************\n",
      "The apriori rule is: spaghetti -> milk\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.3693693693693693\n",
      "The lift for the rule is: 2.121469861898652\n",
      "************************\n",
      "The apriori rule is: chocolate -> milk\n",
      "The support for the rule is: 0.009198773496867084\n",
      "The confidence for the rule is: 0.27710843373493976\n",
      "The lift for the rule is: 2.138467450047102\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.32812500000000006\n",
      "The lift for the rule is: 2.00265713995118\n",
      "************************\n",
      "The apriori rule is: ground beef -> chocolate\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.25\n",
      "The lift for the rule is: 2.544436906377205\n",
      "************************\n",
      "The apriori rule is: chocolate -> frozen vegetables\n",
      "The support for the rule is: 0.007998933475536596\n",
      "The confidence for the rule is: 0.34883720930232565\n",
      "The lift for the rule is: 2.6920040195234\n",
      "************************\n",
      "The apriori rule is: shrimp -> chocolate\n",
      "The support for the rule is: 0.005332622317024397\n",
      "The confidence for the rule is: 0.29629629629629634\n",
      "The lift for the rule is: 3.1084175084175087\n",
      "************************\n",
      "The apriori rule is: ground beef -> chocolate\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.26589595375722547\n",
      "The lift for the rule is: 2.051939865363116\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.009198773496867084\n",
      "The confidence for the rule is: 0.3988439306358382\n",
      "The lift for the rule is: 2.290756756278271\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.013998133582189041\n",
      "The confidence for the rule is: 0.26582278481012656\n",
      "The lift for the rule is: 2.0513752148773245\n",
      "************************\n",
      "The apriori rule is: olive oil -> chocolate\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.3170731707317073\n",
      "The lift for the rule is: 2.4468784502659844\n",
      "************************\n",
      "The apriori rule is: shrimp -> chocolate\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.3037037037037037\n",
      "The lift for the rule is: 2.3437052278616064\n",
      "************************\n",
      "The apriori rule is: spaghetti -> chocolate\n",
      "The support for the rule is: 0.010931875749900012\n",
      "The confidence for the rule is: 0.2789115646258503\n",
      "The lift for the rule is: 2.152382352117802\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.008265564591387815\n",
      "The confidence for the rule is: 0.5040650406504065\n",
      "The lift for the rule is: 2.1146486968225386\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.5526315789473685\n",
      "The lift for the rule is: 2.3183945602260687\n",
      "************************\n",
      "The apriori rule is: chocolate -> tomato sauce\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.3584905660377358\n",
      "The lift for the rule is: 2.1879883936932925\n",
      "************************\n",
      "The apriori rule is: olive oil -> chocolate\n",
      "The support for the rule is: 0.007065724570057326\n",
      "The confidence for the rule is: 0.43089430894308944\n",
      "The lift for the rule is: 2.4748378341363813\n",
      "************************\n",
      "The apriori rule is: shrimp -> chocolate\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.3555555555555556\n",
      "The lift for the rule is: 2.0421303386081338\n",
      "************************\n",
      "The apriori rule is: mineral water -> cooking oil\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.5454545454545454\n",
      "The lift for the rule is: 2.2882855399633923\n",
      "************************\n",
      "The apriori rule is: mineral water -> cooking oil\n",
      "The support for the rule is: 0.007598986801759766\n",
      "The confidence for the rule is: 0.3774834437086093\n",
      "The lift for the rule is: 2.16807297952395\n",
      "************************\n",
      "The apriori rule is: frozen vegetables -> milk\n",
      "The support for the rule is: 0.007332355685908546\n",
      "The confidence for the rule is: 0.3374233128834356\n",
      "The lift for the rule is: 2.6039220884142495\n",
      "************************\n",
      "The apriori rule is: ground beef -> milk\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.29333333333333333\n",
      "The lift for the rule is: 2.2636762688614542\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.010131982402346354\n",
      "The confidence for the rule is: 0.5066666666666667\n",
      "The lift for the rule is: 2.125563012677107\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.008932142381015865\n",
      "The confidence for the rule is: 0.4466666666666667\n",
      "The lift for the rule is: 2.565426237876468\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.48888888888888893\n",
      "The lift for the rule is: 2.050981854337559\n",
      "************************\n",
      "The apriori rule is: olive oil -> spaghetti\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.4222222222222222\n",
      "The lift for the rule is: 2.4250297770971585\n",
      "************************\n",
      "The apriori rule is: mushroom cream sauce -> escalope\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.3006993006993007\n",
      "The lift for the rule is: 3.790832696715049\n",
      "************************\n",
      "The apriori rule is: pasta -> escalope\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.3728813559322034\n",
      "The lift for the rule is: 4.700811850163794\n",
      "************************\n",
      "The apriori rule is: mineral water -> extra dark chocolate\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.47777777777777775\n",
      "The lift for the rule is: 2.0054902692283774\n",
      "************************\n",
      "The apriori rule is: french fries -> frozen vegetables\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.3006993006993007\n",
      "The lift for the rule is: 2.3205200149644596\n",
      "************************\n",
      "The apriori rule is: french fries -> spaghetti\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.40384615384615385\n",
      "The lift for the rule is: 2.319486983154671\n",
      "************************\n",
      "The apriori rule is: mineral water -> milk\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.3026315789473684\n",
      "The lift for the rule is: 2.3354315572882824\n",
      "************************\n",
      "The apriori rule is: milk -> spaghetti\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.3925233644859813\n",
      "The lift for the rule is: 2.254454637832577\n",
      "************************\n",
      "The apriori rule is: ground beef -> frozen vegetables\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.3385826771653543\n",
      "The lift for the rule is: 2.612868993227698\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.009198773496867084\n",
      "The confidence for the rule is: 0.5433070866141732\n",
      "The lift for the rule is: 2.2792765417745597\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.008665511265164644\n",
      "The confidence for the rule is: 0.5118110236220472\n",
      "The lift for the rule is: 2.939582303360625\n",
      "************************\n",
      "The apriori rule is: mineral water -> frozen vegetables\n",
      "The support for the rule is: 0.011065191307825623\n",
      "The confidence for the rule is: 0.3097014925373134\n",
      "The lift for the rule is: 2.3899906332534853\n",
      "************************\n",
      "The apriori rule is: spaghetti -> frozen vegetables\n",
      "The support for the rule is: 0.008265564591387815\n",
      "The confidence for the rule is: 0.3502824858757062\n",
      "The lift for the rule is: 2.011844507315216\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.006532462338354886\n",
      "The confidence for the rule is: 0.5764705882352941\n",
      "The lift for the rule is: 2.4184037373338594\n",
      "************************\n",
      "The apriori rule is: mineral water -> shrimp\n",
      "The support for the rule is: 0.007199040127982935\n",
      "The confidence for the rule is: 0.30508474576271183\n",
      "The lift for the rule is: 3.200616332819722\n",
      "************************\n",
      "The apriori rule is: mineral water -> frozen vegetables\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.6333333333333333\n",
      "The lift for the rule is: 2.6569537658463833\n",
      "************************\n",
      "The apriori rule is: frozen vegetables -> nan\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.27516778523489926\n",
      "The lift for the rule is: 2.886760219646125\n",
      "************************\n",
      "The apriori rule is: spaghetti -> olive oil\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.5058823529411764\n",
      "The lift for the rule is: 2.9055310332402486\n",
      "************************\n",
      "The apriori rule is: spaghetti -> shrimp\n",
      "The support for the rule is: 0.005999200106652446\n",
      "The confidence for the rule is: 0.36\n",
      "The lift for the rule is: 2.067656967840735\n",
      "************************\n",
      "The apriori rule is: tomatoes -> spaghetti\n",
      "The support for the rule is: 0.006665777896280496\n",
      "The confidence for the rule is: 0.41322314049586784\n",
      "The lift for the rule is: 2.373343626998089\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.2900763358778626\n",
      "The lift for the rule is: 2.9523237386972148\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.005332622317024397\n",
      "The confidence for the rule is: 0.47058823529411764\n",
      "The lift for the rule is: 2.7028195658048824\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.006265831222503666\n",
      "The confidence for the rule is: 0.35877862595419846\n",
      "The lift for the rule is: 2.060642016295898\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.43243243243243246\n",
      "The lift for the rule is: 2.483672033442325\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.006665777896280496\n",
      "The confidence for the rule is: 0.39062500000000006\n",
      "The lift for the rule is: 3.975682666214383\n",
      "************************\n",
      "The apriori rule is: ground beef -> nan\n",
      "The support for the rule is: 0.015997866951073192\n",
      "The confidence for the rule is: 0.3234501347708895\n",
      "The lift for the rule is: 3.2919938411349285\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.39999999999999997\n",
      "The lift for the rule is: 2.29739663093415\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.011065191307825623\n",
      "The confidence for the rule is: 0.503030303030303\n",
      "The lift for the rule is: 2.1103077757440176\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.009732035728569524\n",
      "The confidence for the rule is: 0.44242424242424244\n",
      "The lift for the rule is: 2.5410599099726205\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.007465671243834155\n",
      "The confidence for the rule is: 0.5137614678899083\n",
      "The lift for the rule is: 2.1553270529318804\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.5205479452054794\n",
      "The lift for the rule is: 2.1837976157641505\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.017064391414478068\n",
      "The confidence for the rule is: 0.41693811074918563\n",
      "The lift for the rule is: 2.3946805273580716\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.03919477403012932\n",
      "The confidence for the rule is: 0.3989145183175034\n",
      "The lift for the rule is: 2.291162176033379\n",
      "************************\n",
      "The apriori rule is: ground beef -> tomato sauce\n",
      "The support for the rule is: 0.005332622317024397\n",
      "The confidence for the rule is: 0.3773584905660377\n",
      "The lift for the rule is: 3.840659481324083\n",
      "************************\n",
      "The apriori rule is: ground beef -> olive oil\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.4339622641509434\n",
      "The lift for the rule is: 2.4924586090323326\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.44036697247706424\n",
      "The lift for the rule is: 2.5292439973586975\n",
      "************************\n",
      "The apriori rule is: ground beef -> shrimp\n",
      "The support for the rule is: 0.005999200106652446\n",
      "The confidence for the rule is: 0.5232558139534884\n",
      "The lift for the rule is: 3.005315360233627\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.4772727272727273\n",
      "The lift for the rule is: 2.741211889182793\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.005999200106652446\n",
      "The confidence for the rule is: 0.3515625\n",
      "The lift for the rule is: 2.0191962576569678\n",
      "************************\n",
      "The apriori rule is: milk -> nan\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.2611464968152866\n",
      "The lift for the rule is: 2.0152879347854578\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.008532195707239034\n",
      "The confidence for the rule is: 0.5\n",
      "The lift for the rule is: 2.0975950782997765\n",
      "************************\n",
      "The apriori rule is: mineral water -> shrimp\n",
      "The support for the rule is: 0.007865617917610986\n",
      "The confidence for the rule is: 0.3333333333333333\n",
      "The lift for the rule is: 2.5723593964334706\n",
      "************************\n",
      "The apriori rule is: mineral water -> milk\n",
      "The support for the rule is: 0.008532195707239034\n",
      "The confidence for the rule is: 0.5614035087719298\n",
      "The lift for the rule is: 2.3551944738804504\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.01573123583522197\n",
      "The confidence for the rule is: 0.26339285714285715\n",
      "The lift for the rule is: 2.032623273074662\n",
      "************************\n",
      "The apriori rule is: mineral water -> tomatoes\n",
      "The support for the rule is: 0.006532462338354886\n",
      "The confidence for the rule is: 0.2677595628415301\n",
      "The lift for the rule is: 2.066321482380985\n",
      "************************\n",
      "The apriori rule is: mineral water -> turkey\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.5411764705882353\n",
      "The lift for the rule is: 2.270338202395052\n",
      "************************\n",
      "The apriori rule is: olive oil -> milk\n",
      "The support for the rule is: 0.017064391414478068\n",
      "The confidence for the rule is: 0.2596348884381338\n",
      "The lift for the rule is: 2.0036227347473683\n",
      "************************\n",
      "The apriori rule is: milk -> nan\n",
      "The support for the rule is: 0.015197973603519531\n",
      "The confidence for the rule is: 0.3007915567282322\n",
      "The lift for the rule is: 2.3212319619531585\n",
      "************************\n",
      "The apriori rule is: whole wheat pasta -> milk\n",
      "The support for the rule is: 0.009865351286495135\n",
      "The confidence for the rule is: 0.33484162895927605\n",
      "The lift for the rule is: 2.5839990317114503\n",
      "************************\n",
      "The apriori rule is: olive oil -> spaghetti\n",
      "The support for the rule is: 0.007199040127982935\n",
      "The confidence for the rule is: 0.421875\n",
      "The lift for the rule is: 2.4230355091883613\n",
      "************************\n",
      "The apriori rule is: tomatoes -> spaghetti\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.41904761904761906\n",
      "The lift for the rule is: 2.406796470502443\n",
      "************************\n",
      "The apriori rule is: mineral water -> nonfat milk\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.4871794871794871\n",
      "The lift for the rule is: 2.0449542995709753\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.582089552238806\n",
      "The lift for the rule is: 2.44197635981168\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.010265297960271964\n",
      "The confidence for the rule is: 0.3719806763285024\n",
      "The lift for the rule is: 2.13646788142427\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.006799093454206106\n",
      "The confidence for the rule is: 0.39843750000000006\n",
      "The lift for the rule is: 2.2884224253445637\n",
      "************************\n",
      "The apriori rule is: mineral water -> shrimp\n",
      "The support for the rule is: 0.008532195707239034\n",
      "The confidence for the rule is: 0.36158192090395475\n",
      "The lift for the rule is: 2.07674271722861\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.007465671243834155\n",
      "The confidence for the rule is: 0.5233644859813084\n",
      "The lift for the rule is: 2.1956135399025696\n",
      "************************\n",
      "The apriori rule is: mineral water -> tomatoes\n",
      "The support for the rule is: 0.009332089054792695\n",
      "The confidence for the rule is: 0.38251366120218583\n",
      "The lift for the rule is: 2.1969639913304717\n",
      "************************\n",
      "The apriori rule is: olive oil -> spaghetti\n",
      "The support for the rule is: 0.022930275963204905\n",
      "The confidence for the rule is: 0.34888438133874233\n",
      "The lift for the rule is: 2.00381450568293\n",
      "************************\n",
      "The apriori rule is: olive oil -> nan\n",
      "The support for the rule is: 0.007998933475536596\n",
      "The confidence for the rule is: 0.2714932126696833\n",
      "The lift for the rule is: 4.13077198425009\n",
      "************************\n",
      "The apriori rule is: pasta -> shrimp\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.3220338983050847\n",
      "The lift for the rule is: 4.515095833993347\n",
      "************************\n",
      "The apriori rule is: spaghetti -> nan\n",
      "The support for the rule is: 0.009865351286495135\n",
      "The confidence for the rule is: 0.37185929648241206\n",
      "The lift for the rule is: 2.1357707373005916\n",
      "************************\n",
      "The apriori rule is: spaghetti -> nan\n",
      "The support for the rule is: 0.010265297960271964\n",
      "The confidence for the rule is: 0.36492890995260663\n",
      "The lift for the rule is: 2.095966120638976\n",
      "************************\n",
      "The apriori rule is: spaghetti -> tomato sauce\n",
      "The support for the rule is: 0.006265831222503666\n",
      "The confidence for the rule is: 0.4433962264150943\n",
      "The lift for the rule is: 2.546642491837383\n",
      "************************\n",
      "The apriori rule is: pancakes -> olive oil\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.4691358024691358\n",
      "The lift for the rule is: 2.6944775301079535\n",
      "************************\n",
      "The apriori rule is: chocolate -> milk\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.3203125\n",
      "The lift for the rule is: 2.4718766075102883\n",
      "************************\n",
      "The apriori rule is: spaghetti -> chocolate\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.37500000000000006\n",
      "The lift for the rule is: 2.153809341500766\n",
      "************************\n",
      "The apriori rule is: french fries -> nan\n",
      "The support for the rule is: 0.009065457938941474\n",
      "The confidence for the rule is: 0.4121212121212121\n",
      "The lift for the rule is: 2.293264994155202\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.45555555555555555\n",
      "The lift for the rule is: 2.616479496341671\n",
      "************************\n",
      "The apriori rule is: mineral water -> nan\n",
      "The support for the rule is: 0.006932409012131715\n",
      "The confidence for the rule is: 0.28415300546448086\n",
      "The lift for the rule is: 2.192830960894106\n",
      "************************\n",
      "The apriori rule is: spaghetti -> nan\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.3582089552238806\n",
      "The lift for the rule is: 2.0573701172544627\n",
      "************************\n",
      "The apriori rule is: cake -> spaghetti\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.3823529411764706\n",
      "The lift for the rule is: 2.1960408972164673\n",
      "************************\n",
      "The apriori rule is: cake -> mineral water\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.48\n",
      "The lift for the rule is: 2.0148181309457187\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.007598986801759766\n",
      "The confidence for the rule is: 0.5181818181818182\n",
      "The lift for the rule is: 2.1750877549982195\n",
      "************************\n",
      "The apriori rule is: mineral water -> milk\n",
      "The support for the rule is: 0.006665777896280496\n",
      "The confidence for the rule is: 0.29239766081871343\n",
      "The lift for the rule is: 2.256455610906553\n",
      "************************\n",
      "The apriori rule is: spaghetti -> milk\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.3693693693693693\n",
      "The lift for the rule is: 2.121469861898652\n",
      "************************\n",
      "The apriori rule is: chocolate -> milk\n",
      "The support for the rule is: 0.009198773496867084\n",
      "The confidence for the rule is: 0.27710843373493976\n",
      "The lift for the rule is: 2.138467450047102\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.32812500000000006\n",
      "The lift for the rule is: 2.00265713995118\n",
      "************************\n",
      "The apriori rule is: ground beef -> chocolate\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.25\n",
      "The lift for the rule is: 2.544436906377205\n",
      "************************\n",
      "The apriori rule is: chocolate -> frozen vegetables\n",
      "The support for the rule is: 0.007998933475536596\n",
      "The confidence for the rule is: 0.34883720930232565\n",
      "The lift for the rule is: 2.6920040195234\n",
      "************************\n",
      "The apriori rule is: shrimp -> chocolate\n",
      "The support for the rule is: 0.005332622317024397\n",
      "The confidence for the rule is: 0.29629629629629634\n",
      "The lift for the rule is: 3.1084175084175087\n",
      "************************\n",
      "The apriori rule is: ground beef -> chocolate\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.26589595375722547\n",
      "The lift for the rule is: 2.051939865363116\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.009198773496867084\n",
      "The confidence for the rule is: 0.3988439306358382\n",
      "The lift for the rule is: 2.290756756278271\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.013998133582189041\n",
      "The confidence for the rule is: 0.26582278481012656\n",
      "The lift for the rule is: 2.0513752148773245\n",
      "************************\n",
      "The apriori rule is: olive oil -> chocolate\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.3170731707317073\n",
      "The lift for the rule is: 2.4468784502659844\n",
      "************************\n",
      "The apriori rule is: shrimp -> chocolate\n",
      "The support for the rule is: 0.005465937874950006\n",
      "The confidence for the rule is: 0.3037037037037037\n",
      "The lift for the rule is: 2.3437052278616064\n",
      "************************\n",
      "The apriori rule is: spaghetti -> chocolate\n",
      "The support for the rule is: 0.010931875749900012\n",
      "The confidence for the rule is: 0.2789115646258503\n",
      "The lift for the rule is: 2.152382352117802\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.008265564591387815\n",
      "The confidence for the rule is: 0.5040650406504065\n",
      "The lift for the rule is: 2.1158320480798536\n",
      "************************\n",
      "The apriori rule is: mineral water -> chocolate\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.5526315789473685\n",
      "The lift for the rule is: 2.3196919270756635\n",
      "************************\n",
      "The apriori rule is: olive oil -> chocolate\n",
      "The support for the rule is: 0.007065724570057326\n",
      "The confidence for the rule is: 0.43089430894308944\n",
      "The lift for the rule is: 2.4748378341363813\n",
      "************************\n",
      "The apriori rule is: shrimp -> chocolate\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.3555555555555556\n",
      "The lift for the rule is: 2.0421303386081338\n",
      "************************\n",
      "The apriori rule is: mineral water -> cooking oil\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.5454545454545454\n",
      "The lift for the rule is: 2.2895660578928623\n",
      "************************\n",
      "The apriori rule is: mineral water -> cooking oil\n",
      "The support for the rule is: 0.007598986801759766\n",
      "The confidence for the rule is: 0.3774834437086093\n",
      "The lift for the rule is: 2.16807297952395\n",
      "************************\n",
      "The apriori rule is: frozen vegetables -> milk\n",
      "The support for the rule is: 0.007332355685908546\n",
      "The confidence for the rule is: 0.3374233128834356\n",
      "The lift for the rule is: 2.6039220884142495\n",
      "************************\n",
      "The apriori rule is: ground beef -> milk\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.29333333333333333\n",
      "The lift for the rule is: 2.2636762688614542\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.010131982402346354\n",
      "The confidence for the rule is: 0.5066666666666667\n",
      "The lift for the rule is: 2.126752471553815\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.008932142381015865\n",
      "The confidence for the rule is: 0.4466666666666667\n",
      "The lift for the rule is: 2.565426237876468\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.48888888888888893\n",
      "The lift for the rule is: 2.052129577815084\n",
      "************************\n",
      "The apriori rule is: olive oil -> spaghetti\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.4222222222222222\n",
      "The lift for the rule is: 2.4250297770971585\n",
      "************************\n",
      "The apriori rule is: french fries -> frozen vegetables\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.3006993006993007\n",
      "The lift for the rule is: 2.3205200149644596\n",
      "************************\n",
      "The apriori rule is: french fries -> spaghetti\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.40384615384615385\n",
      "The lift for the rule is: 2.319486983154671\n",
      "************************\n",
      "The apriori rule is: mineral water -> milk\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.3026315789473684\n",
      "The lift for the rule is: 2.3354315572882824\n",
      "************************\n",
      "The apriori rule is: milk -> spaghetti\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.3925233644859813\n",
      "The lift for the rule is: 2.254454637832577\n",
      "************************\n",
      "The apriori rule is: ground beef -> frozen vegetables\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.3385826771653543\n",
      "The lift for the rule is: 2.612868993227698\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.009198773496867084\n",
      "The confidence for the rule is: 0.5433070866141732\n",
      "The lift for the rule is: 2.2805520182948587\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.008665511265164644\n",
      "The confidence for the rule is: 0.5118110236220472\n",
      "The lift for the rule is: 2.939582303360625\n",
      "************************\n",
      "The apriori rule is: mineral water -> frozen vegetables\n",
      "The support for the rule is: 0.011065191307825623\n",
      "The confidence for the rule is: 0.3097014925373134\n",
      "The lift for the rule is: 2.3899906332534853\n",
      "************************\n",
      "The apriori rule is: spaghetti -> frozen vegetables\n",
      "The support for the rule is: 0.008265564591387815\n",
      "The confidence for the rule is: 0.3502824858757062\n",
      "The lift for the rule is: 2.011844507315216\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.006532462338354886\n",
      "The confidence for the rule is: 0.5764705882352941\n",
      "The lift for the rule is: 2.4197570690279466\n",
      "************************\n",
      "The apriori rule is: mineral water -> shrimp\n",
      "The support for the rule is: 0.007199040127982935\n",
      "The confidence for the rule is: 0.30508474576271183\n",
      "The lift for the rule is: 3.200616332819722\n",
      "************************\n",
      "The apriori rule is: mineral water -> frozen vegetables\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.6333333333333333\n",
      "The lift for the rule is: 2.658440589442268\n",
      "************************\n",
      "The apriori rule is: spaghetti -> olive oil\n",
      "The support for the rule is: 0.005732568990801226\n",
      "The confidence for the rule is: 0.5058823529411764\n",
      "The lift for the rule is: 2.9055310332402486\n",
      "************************\n",
      "The apriori rule is: spaghetti -> shrimp\n",
      "The support for the rule is: 0.005999200106652446\n",
      "The confidence for the rule is: 0.36\n",
      "The lift for the rule is: 2.067656967840735\n",
      "************************\n",
      "The apriori rule is: tomatoes -> spaghetti\n",
      "The support for the rule is: 0.006665777896280496\n",
      "The confidence for the rule is: 0.41322314049586784\n",
      "The lift for the rule is: 2.373343626998089\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.2900763358778626\n",
      "The lift for the rule is: 2.9523237386972148\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.005332622317024397\n",
      "The confidence for the rule is: 0.47058823529411764\n",
      "The lift for the rule is: 2.7028195658048824\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.006265831222503666\n",
      "The confidence for the rule is: 0.35877862595419846\n",
      "The lift for the rule is: 2.060642016295898\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.43243243243243246\n",
      "The lift for the rule is: 2.483672033442325\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.006665777896280496\n",
      "The confidence for the rule is: 0.39062500000000006\n",
      "The lift for the rule is: 3.975682666214383\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.39999999999999997\n",
      "The lift for the rule is: 2.29739663093415\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.011065191307825623\n",
      "The confidence for the rule is: 0.503030303030303\n",
      "The lift for the rule is: 2.111488697834529\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.009732035728569524\n",
      "The confidence for the rule is: 0.44242424242424244\n",
      "The lift for the rule is: 2.5410599099726205\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.007465671243834155\n",
      "The confidence for the rule is: 0.5137614678899083\n",
      "The lift for the rule is: 2.156533167678904\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.5205479452054794\n",
      "The lift for the rule is: 2.185019662555289\n",
      "************************\n",
      "The apriori rule is: mineral water -> ground beef\n",
      "The support for the rule is: 0.017064391414478068\n",
      "The confidence for the rule is: 0.41693811074918563\n",
      "The lift for the rule is: 2.3946805273580716\n",
      "************************\n",
      "The apriori rule is: ground beef -> olive oil\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.4339622641509434\n",
      "The lift for the rule is: 2.4924586090323326\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.006399146780429276\n",
      "The confidence for the rule is: 0.44036697247706424\n",
      "The lift for the rule is: 2.5292439973586975\n",
      "************************\n",
      "The apriori rule is: ground beef -> shrimp\n",
      "The support for the rule is: 0.005999200106652446\n",
      "The confidence for the rule is: 0.5232558139534884\n",
      "The lift for the rule is: 3.005315360233627\n",
      "************************\n",
      "The apriori rule is: ground beef -> spaghetti\n",
      "The support for the rule is: 0.005599253432875617\n",
      "The confidence for the rule is: 0.4772727272727273\n",
      "The lift for the rule is: 2.741211889182793\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.005999200106652446\n",
      "The confidence for the rule is: 0.3515625\n",
      "The lift for the rule is: 2.0191962576569678\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.008532195707239034\n",
      "The confidence for the rule is: 0.5\n",
      "The lift for the rule is: 2.098768886401791\n",
      "************************\n",
      "The apriori rule is: mineral water -> shrimp\n",
      "The support for the rule is: 0.007865617917610986\n",
      "The confidence for the rule is: 0.3333333333333333\n",
      "The lift for the rule is: 2.5723593964334706\n",
      "************************\n",
      "The apriori rule is: mineral water -> milk\n",
      "The support for the rule is: 0.008532195707239034\n",
      "The confidence for the rule is: 0.5614035087719298\n",
      "The lift for the rule is: 2.356512433854642\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.01573123583522197\n",
      "The confidence for the rule is: 0.26339285714285715\n",
      "The lift for the rule is: 2.032623273074662\n",
      "************************\n",
      "The apriori rule is: mineral water -> tomatoes\n",
      "The support for the rule is: 0.006532462338354886\n",
      "The confidence for the rule is: 0.2677595628415301\n",
      "The lift for the rule is: 2.066321482380985\n",
      "************************\n",
      "The apriori rule is: mineral water -> turkey\n",
      "The support for the rule is: 0.0061325156645780565\n",
      "The confidence for the rule is: 0.5411764705882353\n",
      "The lift for the rule is: 2.2716086770466437\n",
      "************************\n",
      "The apriori rule is: olive oil -> spaghetti\n",
      "The support for the rule is: 0.007199040127982935\n",
      "The confidence for the rule is: 0.421875\n",
      "The lift for the rule is: 2.4230355091883613\n",
      "************************\n",
      "The apriori rule is: tomatoes -> spaghetti\n",
      "The support for the rule is: 0.005865884548726837\n",
      "The confidence for the rule is: 0.41904761904761906\n",
      "The lift for the rule is: 2.406796470502443\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.005199306759098787\n",
      "The confidence for the rule is: 0.582089552238806\n",
      "The lift for the rule is: 2.4433428826767116\n",
      "************************\n",
      "The apriori rule is: mineral water -> olive oil\n",
      "The support for the rule is: 0.010265297960271964\n",
      "The confidence for the rule is: 0.3719806763285024\n",
      "The lift for the rule is: 2.13646788142427\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.006799093454206106\n",
      "The confidence for the rule is: 0.39843750000000006\n",
      "The lift for the rule is: 2.2884224253445637\n",
      "************************\n",
      "The apriori rule is: mineral water -> shrimp\n",
      "The support for the rule is: 0.008532195707239034\n",
      "The confidence for the rule is: 0.36158192090395475\n",
      "The lift for the rule is: 2.07674271722861\n",
      "************************\n",
      "The apriori rule is: mineral water -> spaghetti\n",
      "The support for the rule is: 0.007465671243834155\n",
      "The confidence for the rule is: 0.5233644859813084\n",
      "The lift for the rule is: 2.1968421988504723\n",
      "************************\n",
      "The apriori rule is: mineral water -> tomatoes\n",
      "The support for the rule is: 0.009332089054792695\n",
      "The confidence for the rule is: 0.38251366120218583\n",
      "The lift for the rule is: 2.1969639913304717\n",
      "************************\n",
      "The apriori rule is: pancakes -> olive oil\n",
      "The support for the rule is: 0.005065991201173177\n",
      "The confidence for the rule is: 0.4691358024691358\n",
      "The lift for the rule is: 2.6944775301079535\n",
      "************************\n"
     ]
    }
   ],
   "source": [
    "for rule in apriori_rules:\n",
    "    item_pair = rule[0] \n",
    "    items = [x for x in item_pair]\n",
    "    print(\"The apriori rule is: \" + items[0] + \" -> \" + items[1])\n",
    "\n",
    "    print(\"The support for the rule is: \" + str(rule[1]))\n",
    "\n",
    "    print(\"The confidence for the rule is: \" + str(rule[2][0][2]))\n",
    "    print(\"The lift for the rule is: \" + str(rule[2][0][3]))\n",
    "    print(\"************************\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pycspade.helpers import spade, print_result\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting pycspade\n",
      "\u001b[?25l  Downloading https://files.pythonhosted.org/packages/ce/1e/944df80df772dd1c36fe2f7f8312fd0c27a7453b62ff35d2079cb0495d08/pycspade-0.6.6.tar.gz (91kB)\n",
      "\u001b[K     |████████████████████████████████| 92kB 4.8MB/s eta 0:00:011\n",
      "\u001b[?25hRequirement already satisfied: Cython in /Users/vverdhan/opt/anaconda3/lib/python3.7/site-packages (from pycspade) (0.29.13)\n",
      "Building wheels for collected packages: pycspade\n",
      "  Building wheel for pycspade (setup.py) ... \u001b[?25ldone\n",
      "\u001b[?25h  Created wheel for pycspade: filename=pycspade-0.6.6-cp37-cp37m-macosx_10_9_x86_64.whl size=147988 sha256=475ff67adce96a53a856984f34dabce98fbf75ef70b896a6531933704fd1ce48\n",
      "  Stored in directory: /Users/vverdhan/Library/Caches/pip/wheels/c1/28/9f/9848ec76f6b288333f86697ecaf9642f98ff05d755771174bf\n",
      "Successfully built pycspade\n",
      "Installing collected packages: pycspade\n",
      "Successfully installed pycspade-0.6.6\n"
     ]
    }
   ],
   "source": [
    "import sys\n",
    "!{sys.executable} -m pip install pycspade"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pyECLAT import ECLAT"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "data_frame = pd.read_csv('Data_ECLAT.csv', header = None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "eclat = ECLAT(data=data_frame)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>low fat yogurt</th>\n",
       "      <th>mushroom cream sauce</th>\n",
       "      <th>chicken</th>\n",
       "      <th>hand protein bar</th>\n",
       "      <th>sandwich</th>\n",
       "      <th>vegetables mix</th>\n",
       "      <th>cereals</th>\n",
       "      <th>pepper</th>\n",
       "      <th>zucchini</th>\n",
       "      <th>hot dogs</th>\n",
       "      <th>...</th>\n",
       "      <th>turkey</th>\n",
       "      <th>chutney</th>\n",
       "      <th>babies food</th>\n",
       "      <th>tomato sauce</th>\n",
       "      <th>muffins</th>\n",
       "      <th>fromage blanc</th>\n",
       "      <th>carrots</th>\n",
       "      <th>soup</th>\n",
       "      <th>napkins</th>\n",
       "      <th>ham</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2996</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2997</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2998</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2999</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3000</th>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>...</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>3001 rows × 119 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      low fat yogurt  mushroom cream sauce  chicken  hand protein bar  \\\n",
       "0                  0                     0        0                 0   \n",
       "1                  0                     0        0                 0   \n",
       "2                  0                     0        0                 0   \n",
       "3                  0                     0        0                 0   \n",
       "4                  0                     0        0                 0   \n",
       "...              ...                   ...      ...               ...   \n",
       "2996               0                     0        0                 0   \n",
       "2997               0                     0        0                 0   \n",
       "2998               0                     0        0                 0   \n",
       "2999               0                     0        0                 0   \n",
       "3000               0                     0        0                 0   \n",
       "\n",
       "      sandwich  vegetables mix  cereals  pepper  zucchini  hot dogs  ...  \\\n",
       "0            0               1        0       0         0         0  ...   \n",
       "1            0               0        0       0         0         0  ...   \n",
       "2            0               0        0       0         0         0  ...   \n",
       "3            0               0        0       0         0         0  ...   \n",
       "4            0               0        0       0         0         0  ...   \n",
       "...        ...             ...      ...     ...       ...       ...  ...   \n",
       "2996         0               0        0       0         0         0  ...   \n",
       "2997         0               0        0       0         0         0  ...   \n",
       "2998         0               0        0       0         0         0  ...   \n",
       "2999         0               0        0       0         0         0  ...   \n",
       "3000         0               0        0       0         0         0  ...   \n",
       "\n",
       "      turkey  chutney  babies food  tomato sauce  muffins  fromage blanc  \\\n",
       "0          0        0            0             0        0              0   \n",
       "1          0        0            0             0        0              0   \n",
       "2          0        1            0             0        0              0   \n",
       "3          1        0            0             0        0              0   \n",
       "4          0        0            0             0        0              0   \n",
       "...      ...      ...          ...           ...      ...            ...   \n",
       "2996       0        0            0             0        0              0   \n",
       "2997       0        0            0             0        0              0   \n",
       "2998       0        0            0             0        0              0   \n",
       "2999       0        0            0             0        0              0   \n",
       "3000       0        0            0             0        0              0   \n",
       "\n",
       "      carrots  soup  napkins  ham  \n",
       "0           0     0        0    0  \n",
       "1           0     0        0    0  \n",
       "2           0     0        0    0  \n",
       "3           0     0        0    0  \n",
       "4           0     0        0    0  \n",
       "...       ...   ...      ...  ...  \n",
       "2996        0     0        0    0  \n",
       "2997        0     0        0    0  \n",
       "2998        0     0        0    1  \n",
       "2999        0     0        0    0  \n",
       "3000        0     0        0    0  \n",
       "\n",
       "[3001 rows x 119 columns]"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "eclat.df_bin "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "8it [00:00, 73.22it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Combination 1 by 1\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "47it [00:00, 84.54it/s]\n",
      "18it [00:00, 178.51it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Combination 2 by 2\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "1081it [00:06, 177.15it/s]\n",
      "12it [00:00, 111.92it/s]"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Combination 3 by 3\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "16215it [01:42, 158.41it/s]\n"
     ]
    }
   ],
   "source": [
    "get_ECLAT_indexes, get_ECLAT_supports = eclat.fit(min_support=0.02,\n",
    "                                                           min_combination=1,\n",
    "                                                           max_combination=3,\n",
    "                                                           separator=' & ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'pepper': 0.02865711429523492,\n",
       " 'french fries': 0.15428190603132289,\n",
       " 'light mayo': 0.02332555814728424,\n",
       " 'cake': 0.07697434188603798,\n",
       " 'low fat yogurt': 0.05664778407197601,\n",
       " 'eggs': 0.17727424191936023,\n",
       " 'champagne': 0.042652449183605466,\n",
       " 'ham': 0.027657447517494167,\n",
       " 'milk': 0.12695768077307565,\n",
       " 'honey': 0.03865378207264245,\n",
       " 'cooking oil': 0.04798400533155615,\n",
       " 'mineral water': 0.23692102632455847,\n",
       " 'turkey': 0.06597800733088971,\n",
       " 'cookies': 0.07697434188603798,\n",
       " 'olive oil': 0.06597800733088971,\n",
       " 'spaghetti': 0.18293902032655782,\n",
       " 'energy drink': 0.023992002665778073,\n",
       " 'hot dogs': 0.025658113962012664,\n",
       " 'fresh bread': 0.03032322559146951,\n",
       " 'escalope': 0.07064311896034656,\n",
       " 'soup': 0.054315228257247584,\n",
       " 'red wine': 0.02865711429523492,\n",
       " 'frozen vegetables': 0.09196934355214928,\n",
       " 'chicken': 0.05664778407197601,\n",
       " 'shrimp': 0.0773075641452849,\n",
       " 'brownies': 0.023658780406531157,\n",
       " 'chocolate': 0.1616127957347551,\n",
       " 'green tea': 0.11329556814395202,\n",
       " 'grated cheese': 0.055314895034988334,\n",
       " 'oil': 0.023658780406531157,\n",
       " 'frozen smoothie': 0.04798400533155615,\n",
       " 'meatballs': 0.02165944685104965,\n",
       " 'fresh tuna': 0.025658113962012664,\n",
       " 'energy bar': 0.026657780739753417,\n",
       " 'tomatoes': 0.06864378540486504,\n",
       " 'french wine': 0.02165944685104965,\n",
       " 'whole wheat pasta': 0.03032322559146951,\n",
       " 'muffins': 0.02299233588803732,\n",
       " 'herb & pepper': 0.05031656114628457,\n",
       " 'burgers': 0.08563812062645784,\n",
       " 'ground beef': 0.09363545484838387,\n",
       " 'salmon': 0.03898700433188937,\n",
       " 'avocado': 0.035654781739420195,\n",
       " 'yogurt cake': 0.023992002665778073,\n",
       " 'butter': 0.029656781072975674,\n",
       " 'pancakes': 0.07864045318227257,\n",
       " 'whole wheat rice': 0.045318227257580806,\n",
       " 'french fries & eggs': 0.03432189270243252,\n",
       " 'french fries & mineral water': 0.02299233588803732,\n",
       " 'french fries & spaghetti': 0.02165944685104965,\n",
       " 'french fries & chocolate': 0.027657447517494167,\n",
       " 'french fries & green tea': 0.022325891369543487,\n",
       " 'cake & mineral water': 0.023658780406531157,\n",
       " 'eggs & milk': 0.027990669776741087,\n",
       " 'eggs & mineral water': 0.04798400533155615,\n",
       " 'eggs & spaghetti': 0.03265578140619793,\n",
       " 'eggs & chocolate': 0.028323892035988004,\n",
       " 'eggs & green tea': 0.020659780073308896,\n",
       " 'eggs & burgers': 0.025324891702765744,\n",
       " 'milk & mineral water': 0.048317227590803064,\n",
       " 'milk & spaghetti': 0.03865378207264245,\n",
       " 'milk & chocolate': 0.026991002999000334,\n",
       " 'milk & ground beef': 0.02165944685104965,\n",
       " 'mineral water & olive oil': 0.02732422525824725,\n",
       " 'mineral water & spaghetti': 0.06064645118293902,\n",
       " 'mineral water & soup': 0.025658113962012664,\n",
       " 'mineral water & frozen vegetables': 0.03698767077640786,\n",
       " 'mineral water & shrimp': 0.027990669776741087,\n",
       " 'mineral water & chocolate': 0.04765078307230923,\n",
       " 'mineral water & tomatoes': 0.024991669443518827,\n",
       " 'mineral water & burgers': 0.023992002665778073,\n",
       " 'mineral water & ground beef': 0.03698767077640786,\n",
       " 'mineral water & pancakes': 0.022325891369543487,\n",
       " 'olive oil & spaghetti': 0.021326224591802733,\n",
       " 'spaghetti & frozen vegetables': 0.030989670109963344,\n",
       " 'spaghetti & shrimp': 0.024991669443518827,\n",
       " 'spaghetti & chocolate': 0.03732089303565478,\n",
       " 'spaghetti & tomatoes': 0.023658780406531157,\n",
       " 'spaghetti & burgers': 0.023992002665778073,\n",
       " 'spaghetti & ground beef': 0.03598800399866711}"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_ECLAT_supports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'mineral water': [4,\n",
       "  12,\n",
       "  14,\n",
       "  15,\n",
       "  18,\n",
       "  22,\n",
       "  26,\n",
       "  28,\n",
       "  29,\n",
       "  31,\n",
       "  37,\n",
       "  38,\n",
       "  41,\n",
       "  46,\n",
       "  47,\n",
       "  51,\n",
       "  56,\n",
       "  59,\n",
       "  67,\n",
       "  76,\n",
       "  78,\n",
       "  82,\n",
       "  83,\n",
       "  91,\n",
       "  100,\n",
       "  105,\n",
       "  106,\n",
       "  107,\n",
       "  109,\n",
       "  110,\n",
       "  116,\n",
       "  118,\n",
       "  125,\n",
       "  126,\n",
       "  134,\n",
       "  139,\n",
       "  140,\n",
       "  141,\n",
       "  142,\n",
       "  143,\n",
       "  146,\n",
       "  150,\n",
       "  151,\n",
       "  157,\n",
       "  159,\n",
       "  173,\n",
       "  174,\n",
       "  185,\n",
       "  202,\n",
       "  208,\n",
       "  209,\n",
       "  210,\n",
       "  216,\n",
       "  220,\n",
       "  221,\n",
       "  222,\n",
       "  225,\n",
       "  227,\n",
       "  236,\n",
       "  237,\n",
       "  250,\n",
       "  254,\n",
       "  257,\n",
       "  258,\n",
       "  261,\n",
       "  268,\n",
       "  270,\n",
       "  278,\n",
       "  283,\n",
       "  294,\n",
       "  299,\n",
       "  304,\n",
       "  307,\n",
       "  315,\n",
       "  318,\n",
       "  320,\n",
       "  324,\n",
       "  327,\n",
       "  330,\n",
       "  333,\n",
       "  345,\n",
       "  353,\n",
       "  359,\n",
       "  366,\n",
       "  368,\n",
       "  374,\n",
       "  378,\n",
       "  384,\n",
       "  388,\n",
       "  389,\n",
       "  396,\n",
       "  397,\n",
       "  398,\n",
       "  399,\n",
       "  412,\n",
       "  413,\n",
       "  414,\n",
       "  418,\n",
       "  422,\n",
       "  429,\n",
       "  435,\n",
       "  436,\n",
       "  437,\n",
       "  445,\n",
       "  446,\n",
       "  452,\n",
       "  453,\n",
       "  455,\n",
       "  456,\n",
       "  461,\n",
       "  462,\n",
       "  466,\n",
       "  471,\n",
       "  472,\n",
       "  475,\n",
       "  476,\n",
       "  477,\n",
       "  478,\n",
       "  483,\n",
       "  496,\n",
       "  503,\n",
       "  504,\n",
       "  510,\n",
       "  512,\n",
       "  517,\n",
       "  519,\n",
       "  521,\n",
       "  522,\n",
       "  523,\n",
       "  525,\n",
       "  528,\n",
       "  529,\n",
       "  538,\n",
       "  542,\n",
       "  544,\n",
       "  548,\n",
       "  550,\n",
       "  551,\n",
       "  553,\n",
       "  573,\n",
       "  574,\n",
       "  575,\n",
       "  582,\n",
       "  583,\n",
       "  600,\n",
       "  602,\n",
       "  606,\n",
       "  607,\n",
       "  613,\n",
       "  615,\n",
       "  616,\n",
       "  620,\n",
       "  621,\n",
       "  623,\n",
       "  630,\n",
       "  631,\n",
       "  634,\n",
       "  637,\n",
       "  640,\n",
       "  645,\n",
       "  646,\n",
       "  647,\n",
       "  648,\n",
       "  655,\n",
       "  656,\n",
       "  659,\n",
       "  661,\n",
       "  663,\n",
       "  664,\n",
       "  666,\n",
       "  669,\n",
       "  672,\n",
       "  673,\n",
       "  675,\n",
       "  676,\n",
       "  679,\n",
       "  680,\n",
       "  684,\n",
       "  688,\n",
       "  691,\n",
       "  695,\n",
       "  699,\n",
       "  700,\n",
       "  711,\n",
       "  717,\n",
       "  718,\n",
       "  720,\n",
       "  721,\n",
       "  724,\n",
       "  727,\n",
       "  729,\n",
       "  733,\n",
       "  744,\n",
       "  745,\n",
       "  746,\n",
       "  751,\n",
       "  754,\n",
       "  759,\n",
       "  764,\n",
       "  767,\n",
       "  768,\n",
       "  770,\n",
       "  774,\n",
       "  779,\n",
       "  780,\n",
       "  784,\n",
       "  788,\n",
       "  795,\n",
       "  800,\n",
       "  804,\n",
       "  805,\n",
       "  808,\n",
       "  823,\n",
       "  824,\n",
       "  827,\n",
       "  828,\n",
       "  830,\n",
       "  838,\n",
       "  843,\n",
       "  847,\n",
       "  856,\n",
       "  858,\n",
       "  859,\n",
       "  864,\n",
       "  868,\n",
       "  871,\n",
       "  878,\n",
       "  881,\n",
       "  890,\n",
       "  901,\n",
       "  913,\n",
       "  919,\n",
       "  954,\n",
       "  973,\n",
       "  974,\n",
       "  975,\n",
       "  982,\n",
       "  983,\n",
       "  989,\n",
       "  990,\n",
       "  992,\n",
       "  994,\n",
       "  995,\n",
       "  998,\n",
       "  1008,\n",
       "  1009,\n",
       "  1015,\n",
       "  1016,\n",
       "  1024,\n",
       "  1031,\n",
       "  1037,\n",
       "  1041,\n",
       "  1042,\n",
       "  1044,\n",
       "  1055,\n",
       "  1056,\n",
       "  1058,\n",
       "  1064,\n",
       "  1066,\n",
       "  1067,\n",
       "  1069,\n",
       "  1070,\n",
       "  1079,\n",
       "  1083,\n",
       "  1084,\n",
       "  1085,\n",
       "  1091,\n",
       "  1093,\n",
       "  1095,\n",
       "  1098,\n",
       "  1104,\n",
       "  1106,\n",
       "  1107,\n",
       "  1116,\n",
       "  1118,\n",
       "  1121,\n",
       "  1130,\n",
       "  1136,\n",
       "  1139,\n",
       "  1145,\n",
       "  1152,\n",
       "  1158,\n",
       "  1161,\n",
       "  1168,\n",
       "  1173,\n",
       "  1174,\n",
       "  1178,\n",
       "  1179,\n",
       "  1181,\n",
       "  1183,\n",
       "  1190,\n",
       "  1204,\n",
       "  1213,\n",
       "  1216,\n",
       "  1218,\n",
       "  1221,\n",
       "  1223,\n",
       "  1225,\n",
       "  1227,\n",
       "  1235,\n",
       "  1242,\n",
       "  1248,\n",
       "  1249,\n",
       "  1254,\n",
       "  1257,\n",
       "  1261,\n",
       "  1273,\n",
       "  1274,\n",
       "  1276,\n",
       "  1279,\n",
       "  1281,\n",
       "  1287,\n",
       "  1289,\n",
       "  1290,\n",
       "  1300,\n",
       "  1303,\n",
       "  1314,\n",
       "  1326,\n",
       "  1330,\n",
       "  1345,\n",
       "  1347,\n",
       "  1356,\n",
       "  1358,\n",
       "  1360,\n",
       "  1365,\n",
       "  1367,\n",
       "  1369,\n",
       "  1370,\n",
       "  1371,\n",
       "  1373,\n",
       "  1377,\n",
       "  1378,\n",
       "  1384,\n",
       "  1388,\n",
       "  1392,\n",
       "  1397,\n",
       "  1400,\n",
       "  1408,\n",
       "  1413,\n",
       "  1414,\n",
       "  1416,\n",
       "  1420,\n",
       "  1424,\n",
       "  1425,\n",
       "  1428,\n",
       "  1429,\n",
       "  1430,\n",
       "  1442,\n",
       "  1443,\n",
       "  1453,\n",
       "  1465,\n",
       "  1466,\n",
       "  1473,\n",
       "  1474,\n",
       "  1480,\n",
       "  1485,\n",
       "  1486,\n",
       "  1489,\n",
       "  1490,\n",
       "  1493,\n",
       "  1494,\n",
       "  1496,\n",
       "  1513,\n",
       "  1517,\n",
       "  1521,\n",
       "  1524,\n",
       "  1525,\n",
       "  1534,\n",
       "  1539,\n",
       "  1540,\n",
       "  1543,\n",
       "  1546,\n",
       "  1547,\n",
       "  1550,\n",
       "  1561,\n",
       "  1562,\n",
       "  1564,\n",
       "  1566,\n",
       "  1579,\n",
       "  1584,\n",
       "  1588,\n",
       "  1590,\n",
       "  1591,\n",
       "  1596,\n",
       "  1597,\n",
       "  1604,\n",
       "  1605,\n",
       "  1607,\n",
       "  1609,\n",
       "  1610,\n",
       "  1611,\n",
       "  1612,\n",
       "  1613,\n",
       "  1624,\n",
       "  1626,\n",
       "  1627,\n",
       "  1629,\n",
       "  1631,\n",
       "  1632,\n",
       "  1634,\n",
       "  1638,\n",
       "  1639,\n",
       "  1640,\n",
       "  1642,\n",
       "  1643,\n",
       "  1656,\n",
       "  1659,\n",
       "  1679,\n",
       "  1681,\n",
       "  1685,\n",
       "  1687,\n",
       "  1695,\n",
       "  1699,\n",
       "  1702,\n",
       "  1711,\n",
       "  1714,\n",
       "  1725,\n",
       "  1729,\n",
       "  1730,\n",
       "  1732,\n",
       "  1736,\n",
       "  1743,\n",
       "  1748,\n",
       "  1750,\n",
       "  1754,\n",
       "  1757,\n",
       "  1758,\n",
       "  1763,\n",
       "  1766,\n",
       "  1768,\n",
       "  1771,\n",
       "  1773,\n",
       "  1778,\n",
       "  1780,\n",
       "  1784,\n",
       "  1785,\n",
       "  1790,\n",
       "  1792,\n",
       "  1801,\n",
       "  1804,\n",
       "  1806,\n",
       "  1813,\n",
       "  1815,\n",
       "  1816,\n",
       "  1818,\n",
       "  1826,\n",
       "  1830,\n",
       "  1831,\n",
       "  1839,\n",
       "  1840,\n",
       "  1848,\n",
       "  1852,\n",
       "  1853,\n",
       "  1869,\n",
       "  1875,\n",
       "  1877,\n",
       "  1886,\n",
       "  1888,\n",
       "  1892,\n",
       "  1895,\n",
       "  1896,\n",
       "  1902,\n",
       "  1903,\n",
       "  1905,\n",
       "  1906,\n",
       "  1909,\n",
       "  1912,\n",
       "  1919,\n",
       "  1924,\n",
       "  1931,\n",
       "  1934,\n",
       "  1935,\n",
       "  1937,\n",
       "  1942,\n",
       "  1958,\n",
       "  1968,\n",
       "  1977,\n",
       "  1978,\n",
       "  1980,\n",
       "  1983,\n",
       "  1984,\n",
       "  1986,\n",
       "  1989,\n",
       "  1991,\n",
       "  1992,\n",
       "  2003,\n",
       "  2004,\n",
       "  2005,\n",
       "  2007,\n",
       "  2009,\n",
       "  2010,\n",
       "  2018,\n",
       "  2019,\n",
       "  2022,\n",
       "  2038,\n",
       "  2039,\n",
       "  2044,\n",
       "  2045,\n",
       "  2046,\n",
       "  2059,\n",
       "  2061,\n",
       "  2063,\n",
       "  2064,\n",
       "  2067,\n",
       "  2075,\n",
       "  2083,\n",
       "  2085,\n",
       "  2090,\n",
       "  2099,\n",
       "  2101,\n",
       "  2104,\n",
       "  2111,\n",
       "  2113,\n",
       "  2118,\n",
       "  2121,\n",
       "  2123,\n",
       "  2124,\n",
       "  2130,\n",
       "  2131,\n",
       "  2135,\n",
       "  2143,\n",
       "  2144,\n",
       "  2145,\n",
       "  2152,\n",
       "  2155,\n",
       "  2170,\n",
       "  2172,\n",
       "  2178,\n",
       "  2181,\n",
       "  2186,\n",
       "  2190,\n",
       "  2192,\n",
       "  2195,\n",
       "  2197,\n",
       "  2203,\n",
       "  2206,\n",
       "  2207,\n",
       "  2213,\n",
       "  2216,\n",
       "  2217,\n",
       "  2223,\n",
       "  2226,\n",
       "  2228,\n",
       "  2236,\n",
       "  2241,\n",
       "  2246,\n",
       "  2248,\n",
       "  2253,\n",
       "  2255,\n",
       "  2257,\n",
       "  2261,\n",
       "  2266,\n",
       "  2268,\n",
       "  2272,\n",
       "  2277,\n",
       "  2279,\n",
       "  2282,\n",
       "  2287,\n",
       "  2289,\n",
       "  2290,\n",
       "  2292,\n",
       "  2293,\n",
       "  2294,\n",
       "  2298,\n",
       "  2301,\n",
       "  2303,\n",
       "  2308,\n",
       "  2318,\n",
       "  2320,\n",
       "  2321,\n",
       "  2325,\n",
       "  2329,\n",
       "  2334,\n",
       "  2353,\n",
       "  2356,\n",
       "  2358,\n",
       "  2367,\n",
       "  2368,\n",
       "  2369,\n",
       "  2374,\n",
       "  2375,\n",
       "  2377,\n",
       "  2389,\n",
       "  2391,\n",
       "  2392,\n",
       "  2395,\n",
       "  2400,\n",
       "  2403,\n",
       "  2411,\n",
       "  2412,\n",
       "  2427,\n",
       "  2429,\n",
       "  2437,\n",
       "  2462,\n",
       "  2467,\n",
       "  2477,\n",
       "  2482,\n",
       "  2483,\n",
       "  2485,\n",
       "  2494,\n",
       "  2495,\n",
       "  2497,\n",
       "  2509,\n",
       "  2510,\n",
       "  2513,\n",
       "  2519,\n",
       "  2524,\n",
       "  2525,\n",
       "  2527,\n",
       "  2528,\n",
       "  2529,\n",
       "  2530,\n",
       "  2542,\n",
       "  2546,\n",
       "  2550,\n",
       "  2551,\n",
       "  2559,\n",
       "  2571,\n",
       "  2578,\n",
       "  2583,\n",
       "  2589,\n",
       "  2591,\n",
       "  2592,\n",
       "  2593,\n",
       "  2595,\n",
       "  2600,\n",
       "  2601,\n",
       "  2603,\n",
       "  2606,\n",
       "  2613,\n",
       "  2617,\n",
       "  2625,\n",
       "  2626,\n",
       "  2628,\n",
       "  2629,\n",
       "  2632,\n",
       "  2637,\n",
       "  2638,\n",
       "  2643,\n",
       "  2645,\n",
       "  2648,\n",
       "  2649,\n",
       "  2657,\n",
       "  2664,\n",
       "  2667,\n",
       "  2669,\n",
       "  2673,\n",
       "  2676,\n",
       "  2677,\n",
       "  2679,\n",
       "  2688,\n",
       "  2691,\n",
       "  2693,\n",
       "  2695,\n",
       "  2699,\n",
       "  2700,\n",
       "  2711,\n",
       "  2753,\n",
       "  2763,\n",
       "  2765,\n",
       "  2766,\n",
       "  2767,\n",
       "  2773,\n",
       "  2775,\n",
       "  2776,\n",
       "  2782,\n",
       "  2783,\n",
       "  2788,\n",
       "  2791,\n",
       "  2792,\n",
       "  2795,\n",
       "  2798,\n",
       "  2805,\n",
       "  2808,\n",
       "  2809,\n",
       "  2817,\n",
       "  2819,\n",
       "  2827,\n",
       "  2831,\n",
       "  2832,\n",
       "  2850,\n",
       "  2851,\n",
       "  2852,\n",
       "  2853,\n",
       "  2855,\n",
       "  2865,\n",
       "  2866,\n",
       "  2869,\n",
       "  2871,\n",
       "  2885,\n",
       "  2886,\n",
       "  2888,\n",
       "  2892,\n",
       "  2898,\n",
       "  2903,\n",
       "  2905,\n",
       "  2910,\n",
       "  2919,\n",
       "  2930,\n",
       "  2932,\n",
       "  2939,\n",
       "  2942,\n",
       "  2953,\n",
       "  2961,\n",
       "  2980,\n",
       "  2981,\n",
       "  2992,\n",
       "  2993,\n",
       "  2994,\n",
       "  2998,\n",
       "  2999]}"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_ECLAT_indexes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "get_ECLAT_indexes_all, get_ECLAT_supports_all = eclat.fit_all(min_support=0.2,\n",
    "                                                           separator=' & ')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{}"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "get_ECLAT_indexes_all"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Collecting fpgrowth_py\n",
      "  Downloading https://files.pythonhosted.org/packages/18/51/e0cc561ab4a1079c1fad85a43bfa1a95fbe1f4f27c866d12b4d79f95b1ac/fpgrowth_py-1.0.0-py3-none-any.whl\n",
      "Installing collected packages: fpgrowth-py\n",
      "Successfully installed fpgrowth-py-1.0.0\n"
     ]
    }
   ],
   "source": [
    "!{sys.executable} -m pip install fpgrowth_py"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {},
   "outputs": [],
   "source": [
    "from fpgrowth_py import fpgrowth"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [],
   "source": [
    "items = pd.read_table('data.csv')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "freqItemSet, rules = fpgrowth(items, minSupRatio=0.8, minConf=0.8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[{'8'}, {'5'}, 1.0]\n"
     ]
    }
   ],
   "source": [
    "print(rules[0])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "from pycspade.helpers import spade, print_result\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "spade_result = spade(filename='SPADE_dataset.txt', support=0.6, parse=True)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   Occurs     Accum   Support    Confid      Lift                                                                         Sequence\n",
      "       88        88 0.7927928       N/A       N/A                                                                             (10) \n",
      "       68        68 0.6126126 0.7727273 0.8168831                                                                        (10)->(6) \n",
      "       67        67 0.6036036 0.7613636 0.7825126                                                                        (10)->(9) \n",
      "       88        88 0.7927928       N/A       N/A                                                                              (3) \n",
      "       71        71 0.6396396 0.8068182 0.8292298                                                                         (3)->(9) \n",
      "      102       560 0.9189189       N/A       N/A                                                                              (4) \n",
      "       79        79 0.7117117 0.7745098 0.8428489                                                                         (4)->(4) \n",
      "       77        77 0.6936937 0.7549020 0.7980392                                                                         (4)->(5) \n",
      "       83        83 0.7477477 0.8137255 0.8602241                                                                         (4)->(6) \n",
      "       80        80 0.7207207 0.7843137 0.8136339                                                                         (4)->(7) \n",
      "       77        77 0.6936937 0.7549020 0.7831226                                                                         (4)->(8) \n",
      "       83        83 0.7477477 0.8137255 0.8363290                                                                         (4)->(9) \n",
      "      105       580 0.9459459       N/A       N/A                                                                              (5) \n",
      "       73        73 0.6576577 0.6952381 0.7565826                                                                         (5)->(4) \n",
      "       77        77 0.6936937 0.7333333 0.7752381                                                                         (5)->(5) \n",
      "       85        85 0.7657658 0.8095238 0.8557823                                                                         (5)->(6) \n",
      "       78        78 0.7027027 0.7428571 0.7706275                                                                         (5)->(7) \n",
      "       78        78 0.7027027 0.7428571 0.7706275                                                                         (5)->(8) \n",
      "       80        80 0.7207207 0.7619048 0.7830688                                                                         (5)->(9) \n",
      "      105       684 0.9459459       N/A       N/A                                                                              (6) \n",
      "       74        74 0.6666667 0.7047619 0.7669468                                                                         (6)->(4) \n",
      "       80        80 0.7207207 0.7619048 0.8054422                                                                         (6)->(5) \n",
      "       82        82 0.7387387 0.7809524 0.8255782                                                                         (6)->(6) \n",
      "       72        72 0.6486486 0.6857143 0.7113485                                                                         (6)->(7) \n",
      "       78        78 0.7027027 0.7428571 0.7706275                                                                         (6)->(8) \n",
      "       83        83 0.7477477 0.7904762 0.8124339                                                                         (6)->(9) \n",
      "      107       573 0.9639640       N/A       N/A                                                                              (7) \n",
      "       72        72 0.6486486 0.6728972 0.7322705                                                                         (7)->(4) \n",
      "       76        76 0.6846847 0.7102804 0.7508678                                                                         (7)->(5) \n",
      "       85        85 0.7657658 0.7943925 0.8397864                                                                         (7)->(6) \n",
      "       72        72 0.6486486 0.6728972 0.6980522                                                                         (7)->(7) \n",
      "       76        76 0.6846847 0.7102804 0.7368329                                                                         (7)->(8) \n",
      "       82        82 0.7387387 0.7663551 0.7876428                                                                         (7)->(9) \n",
      "      107       578 0.9639640       N/A       N/A                                                                              (8) \n",
      "       82        82 0.7387387 0.7663551 0.8339747                                                                         (8)->(4) \n",
      "       85        85 0.7657658 0.7943925 0.8397864                                                                         (8)->(5) \n",
      "       89        89 0.8018018 0.8317757 0.8793057                                                                         (8)->(6) \n",
      "       83        83 0.7477477 0.7757009 0.8046991                                                                         (8)->(7) \n",
      "       79        79 0.7117117 0.7383178 0.7659184                                                                         (8)->(8) \n",
      "       85        85 0.7657658 0.7943925 0.8164590                                                                         (8)->(9) \n",
      "      108       742 0.9729730       N/A       N/A                                                                              (9) \n",
      "       78        78 0.7027027 0.7222222 0.7859477                                                                         (9)->(4) \n",
      "       80        80 0.7207207 0.7407407 0.7830688                                                                         (9)->(5) \n",
      "       87        87 0.7837838 0.8055556 0.8515873                                                                         (9)->(6) \n",
      "       81        81 0.7297297 0.7500000 0.7780374                                                                         (9)->(7) \n",
      "       83        83 0.7477477 0.7685185 0.7972482                                                                         (9)->(8) \n",
      "       83        83 0.7477477 0.7685185 0.7898663                                                                         (9)->(9) \n"
     ]
    }
   ],
   "source": [
    "print_result(spade_result)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
